    /**
     * create by Mr.X
     * 2021.07.06
     * version v 1.0
     */

    //问号提示语
    $(".Qtip").hover(function() {
        showTip(this);
    }, function() {
        showTip();
    });

    function showTip(f) {
        let d = $(f).next();
        if (!f) {
            $(".tipDiv").hide()
        } else {
            let e = $(f).position();
            let a = e.left - 108;
            let b = e.top + 30;
            d.css({
                left : a + "px",
                top : b + "px"
            }).show();
        }
    }
    /**
     * 动态加载lable导航宽度
     */
    $(function(){
        debugger;
        const bannerWidth = $(window).width() - $(".page-sidebar").width();
        //const s = $("#plableArea", $.cssTab.focus()).css("width");
        $("#plableArea",$.cssTab.focus()).css("width",bannerWidth);
    })

    /**
     * 人员信息弹框 + lable 公共”保存“按钮事件
     * @param operFlag
     * @param mode
     * @param formName
     * @param lableId
     * @param userId
     */
    function save(operFlag,mode,formName,lableId,userId){
        let $focus = (mode === 'dialog' ? $css.focusDialog() : $.cssTab.focus());
        if(!$("#"+formName, $focus).valid()){
            topFunc();
            $.dialog.tips("请检查表单是否填写有误！",1,'tips.gif');
            return false;
        }
        var toUrl = ( operFlag === 'add' ? "addUserInfoPage.action" : "updUserInfoPage.action") + "?mode=" + mode;
        var parms = $("#"+formName, $focus).serialize();
        $css.post(toUrl,parms, function(data) {
            if (0 === data.result) {
                if(mode === 'dialog'){
                    $css.closeDialog();
                }
                //刷新lable页
                $css.tip('保存成功！');
                $css.post("getUserInfoPage.action",{ "lableId":data.info.lableId, "userId":data.info.userId }, function(data) {
                    $("#userInfoArea", $.cssTab.focus()).html(data);
                }, 'html');
            } else {
                $css.alert(data.msg);
            }
            topFunc();
        }, 'json');
    }

    //滑动置顶
    function topFunc(){
        $(".tab-content").animate({
            scrollTop:0
        },300);
    }

    function scrollTop(){
        var timer = null;
        cancelAnimationFrame(timer);
        timer = requestAnimationFrame(function fn(){
            var oTop = document.body.scrollTop || document.documentElement.scrollTop;
            if(oTop > 0){
                document.body.scrollTop = document.documentElement.scrollTop = oTop - 50;
                timer = requestAnimationFrame(fn);
            }else{
                cancelAnimationFrame(timer);
            }
        });
    }

    /**
     * lable页获取弹框
     * @param id
     * @param title
     * @param lableId
     * @param userId
     */
    function getDia(id,title,lableId,userId){
        debugger;
        $css.openDialog({
            id:id,
            title:title,
            url:'getUserInfoDialog.action',
            lock:true,
            data:{
                lableId:lableId,
                userId:userId
            }
        });
    }

    /**
     * 删除回调刷新lable页
     * @param lableId
     * @param userId
     */
    function refreshTable(lableId,userId){
        $css.post("getUserInfoPage.action",{ "lableId":lableId, "userId":userId}, function(data) {
            $("#userInfoArea", $.cssTab.focus()).html(data);
        }, 'html');
    }

    /*
     *机构数相关内容
     */
    var getuser_setting = {
        check: {
            enable: true,
            chkboxType: { "Y": "", "N": "ps" },
            chkStyle: "checkbox",
            radioType: "all"
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            beforeClick : getuser_beforeClick,
            onCheck: getuser_onCheck
        }
    };

    function getuser_beforeClick(treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj(treeId);
        zTree.checkNode(treeNode, !treeNode.checked, null, true);
        return false;
    }

    function getuser_onCheck(e, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj(treeId),
            nodes = zTree.getCheckedNodes(true),
            v = "",
            v1 = "";
        for (var i=0, l=nodes.length; i<l; i++) {
            v += nodes[i].name + ",";
            v1 += nodes[i].id + ",";
        }
        if (v.length > 0 ) v = v.substring(0, v.length-1);
        if (v1.length > 0 ) v1 = v1.substring(0, v1.length-1);
        $("#myOrgName").val(v);
        $("#myOrgIds").val(v1);
        hideOrgTreeContent();
    }

    function showOrgTreeContent() {
        $("#myOrgTreeContent",$navTab.focus()).slideDown("fast");
        $("#user_info_form",$navTab.focus()).bind("mousedown", getuser_onBodyDown);
    }
    function hideOrgTreeContent() {
        $("#myOrgTreeContent",$navTab.focus()).fadeOut("fast");
        $("#user_info_form",$navTab.focus()).unbind("mousedown", getuser_onBodyDown);
    }
    function getuser_onBodyDown(event) {
        if (!(event.target.id == "changeBtn"
            || event.target.id == "myOrgName"
            || event.target.id == "myOrgTreeContent"
            || $(event.target).parents("#myOrgTreeContent").length>0)) {
            hideOrgTreeContent();
        }
    }

    /*--------- 自定义下拉选start ----------------*/

    // 展示自定义下拉选——带搜索框
    function showCustomizedContent(el) {
        var $content = $(el).next();
        $content.show();
        $(el).parents("form").bind("mousedown", bingdingHide);
    }

    //绑定隐藏事件
    function bingdingHide(event) {
        if (!( event.target.getAttribute("class") == "customizedContent" || $(event.target).parents(".customizedContent").length>0)) {
            hideCustomizedContent();
        }
    }

    //隐藏自定义下拉选——带搜索框
    function hideCustomizedContent() {
        $(".customizedContent").fadeOut("fast");
    }

    //点击选项自动带入
    function chooseItem(el){
        //var param = $(el).attr("id");
        var name = $(el).html();
        $(el).parent().parent().prev().val(name);
        hideCustomizedContent();
    }

    //输入检索条件自动进行数据过滤,刷新数据展示区
    function itemFilter(tablename,el) {
        var param = $(el).val();
        $css.post("dirDictFilter.action",{"tableName":tablename,"param":param}, function(data) {
            $(el).parent().next().html(data);
        }, 'html');
    }

    /*--------- 自定义下拉选end ----------------*/

    //-----------------------userinfo页专用----------------------
    //添加成员
    function addMember() {
        var appendStr = "<tr style=\"line-height: 35px;height: 35px;\">"
            + "<td class=\"text-center\"><input type=\"text\" name=\"appellation\" class=\"form-control\"></td>"
            + "<td class=\"text-center\"><input type=\"text\" name=\"membername\" class=\"form-control\"></td>"
            + "<td class=\"text-center\"><input type=\"text\" name=\"birthday\" class=\"Wdate form-control\" readonly=\"readonly\" onclick=\"WdatePicker({dateFmt:'yyyy-MM',maxDate:'%y-%M'})\" onchange=\"createFamilyJson();\"></td>"
            + "<td class=\"text-center\"><input type=\"text\" name=\"politicallandscape\" class=\"form-control\"></td>"
            + "<td class=\"text-center\"><input type=\"text\" name=\"unitandposition\" class=\"form-control\"></td>"
            + "<td class=\"text-center\"> <a onclick=\"delMember(this)\" style=\"display:inline-block;\" href=\"javascript:;\">删除</a></td>"
            + "</tr>"
        $("#family_new",$navTab.focus()).append(appendStr);
        $("#family_new",$navTab.focus()).find("input").bind('change',function(e){
            createFamilyJson();
        });
    }

    //删除成员
    function delMember(el) {
        $(el).parent().parent().remove();
        createFamilyJson();
    }

    //构建家庭成员JSon
    function createFamilyJson() {
        var appellationArr=createEleArray($("input[name='appellation']"));
        var membernameArr=createEleArray($("input[name='membername']"));
        var birthdayArr = createEleArray($("input[name='birthday']"));
        var politicallandscapeArr =createEleArray($("input[name='politicallandscape']"));
        var unitandpositionArr = createEleArray($("input[name='unitandposition']"));
        var familyJson=[];
        for(i=0;i<appellationArr.length;i++){
            var familyItem={};
            familyItem.appellation= appellationArr[i];
            familyItem.membername=membernameArr[i];
            familyItem.birthday=birthdayArr[i];
            familyItem.politicallandscape=politicallandscapeArr[i];
            familyItem.unitandposition=unitandpositionArr[i];
            familyJson.push(familyItem);
        }
        $("#familyJsonStr").val(JSON.stringify(familyJson));
    }

    //构建家庭成员元素数组
    function createEleArray(el) {
        var arr = [];
        $(el).each(function (index, domEle) {
            arr.push($(domEle).val());
        });
        return arr;
    }



